<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="org.springframework.context.ApplicationContext"%>
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<%@ page import="org.springframework.web.servlet.support.RequestContextUtils" %>   
<%@ page import="it.cst.entity.service.*" %>
<%@ page import="it.cst.entity.*" %>
<%@ page import="it.cst.util.UserStat" %>
<%@ page import="java.text.*" %>
 
<%
   ApplicationContext ctx = RequestContextUtils.getWebApplicationContext(request);
   UserService us = (UserService) ctx.getBean("userService");
%>        
<!DOCTYPE html> 
<html> 
	<head> 
	<title>CST</title> 
	<meta name="viewport" content="width=device-width, initial-scale=1"> 
	<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0-beta.1/jquery.mobile-1.2.0-beta.1.min.css" />
	<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
	<script src="http://code.jquery.com/mobile/1.2.0-beta.1/jquery.mobile-1.2.0-beta.1.min.js"></script>
	</head>
	<body> 
<div data-role="page">
	<div data-role="header">
		<h1>Classifica Giocatori</h1>
	</div><!-- /header -->
	<div data-role="content">
		   <table style="width:100%;align:center;border-collapse:collapse">
		   		<tr bgcolor="lightgrey">
			   		<td style="width:30%"><b>Giocatore</b></td>
			   		<td style="width:20%;text-align:center"><b>% Win</b></td>
			   		<td style="width:20%;text-align:center"><b>% Lose</b></td>
			   		<td style="width:20%;text-align:center"><b>N</b></td>
			   	</tr>
			   	<tr>
			   		<td style="width:30%"></td>
			   		<td style="width:20%"></td>
			   		<td style="width:20%"></td>
			   		<td style="width:20%"></td>
			   	</tr>		   	
		   	<%for(UserStat ust : us.getUserStat()){%>		
			   	<tr>
			   		<td style="width:30%">
			   			<%=ust.getUser().getFirstname()%> <%=ust.getUser().getLastname()%>
			   		</td>
			   		<td style="width:20%;text-align:center">
					   <%= new DecimalFormat("###.##").format(ust.getPercMatchWin()) %>
			   		</td>
			   		<td style="width:20%;text-align:center">
					   <%= new DecimalFormat("###.##").format(ust.getPercMatchLoose()) %>
			   		</td>
			   		<td style="width:20%;text-align:center">
					   <%= new DecimalFormat("###.##").format(ust.getTotMatch()) %>
			   		</td>
			   	</tr>
		   	<%}%>
		   </table>
		   <table style="width:100%;align:center;border-collapse:collapse">
		   	<tr>
		   		<td>
		   			<center><a href="home" data-role="button" data-transition="slidefade">Home</a></center>
		   		</td>
		   	</tr>
		   </table>		
	</div><!-- /content -->
</div><!-- /page -->
</body>
</html>